package com.zhang.configserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

/**
 * HTTP服务具有以下形式的资源：
 *
 * /{application}/
 * {profile}[/{label}]
 * /{application}-{profile}.yml
 * /{label}/{application}-{profile}.yml
 * /{application}-{profile}.properties
 * /{label}/{application}-{profile}.properties
 *
 * config是我的配置文件前缀 dev表示开发环境 master表示分支
 *
 * http://localhost:8769/config/dev/master
 *
 * response:
     {
         name: "config",
         profiles: [
            "dev"
         ],
         label: "master",
         version: "d6f223fe1891ac4eb6c2224e95bcdadae14f6e64",
         state: null,
         propertySources: [
             {
                 name: "https://gitee.com/harry-z/SpringCloudConfig/config-repo/config-dev.properties",
                 source: {
                    my.name: "zhd"
                 }
             }
         ]
     }


    本地调用
    http://localhost:8769/config/dev/master
     {
         name: "config",
         profiles: [
            "dev"
         ],
         label: null,
         version: "1.0.0",
         state: null,
         propertySources: [
             {
                 name: "classpath:/config/config-dev.properties",
                 source: {
                     my.name: "zhd-local"
                 }
             }
         ]
     }

     JDBC调用
     http://localhost:8769/config/dev/master
     {
         name: "config",
         profiles: [
            "dev"
         ],
         label: null,
         version: null,
         state: null,
         propertySources: [
             {
                 name: "config-dev",
                 source: {
                    my.name: "zhd-jdbc"
                 }
             }
         ]
     }
 * @author zhanghaidong
 */
@RefreshScope
@EnableConfigServer
@EnableEurekaClient
@SpringBootApplication
public class ConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }

}
